/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package parsertojaklin;

import java.io.File;
import java.util.LinkedList;

/**
 *
 * @author Юра
 */
public class Vendor  {
    public String table_name = "vendors";
    static  File dir = new File("D:\\projects\\optvideo\\optvideo\\optvideo.com\\new_design\\new_kat\\katalog\\brend\\");
//http://optvideo.com/new_design/new_kat/katalog.php?kategory=102532&grupp=%DD%CB%C5%CC%C5%CD%D2%DB%20%CF%C8%D2%C0%CD%C8%DF&tab=1
    public String id_vendor;
    public String name_vendor;
    
    Vendor (){
    }

    public static  LinkedList<String> parse_vendors(){
            LinkedList<String> vendors = new LinkedList();
            String[] dir_list = dir.list();

            int c=0;
            //String substr = "view.php-kod=";   // wares
            //String substr = "news_vybrat";     // stat`i
            String file_name = "katalog.php-brend_from_head=";  // vendors
//katalog.php-brend_from_head=SAMSUNG


            for (String filename :dir_list)
                //if (filename.length()>=file_name.length() && filename.substring(0,file_name.length()).equals(file_name) )
                {
                    Vendor vendor = new Vendor();
                    vendor.name_vendor = filename.substring(file_name.length(),filename.length()-4);
                    //System.out.println(vendor.id_vendor+"_"+vendor.name_vendor);
                    vendors.add(vendor.name_vendor);
                }
            return vendors;
    }
}
